#include "../../core/base/timer.h"
#include <windows.h>

double GetSystemElapsedTime()
{
	LARGE_INTEGER t;
	LARGE_INTEGER freq;
	QueryPerformanceCounter(&t);
	QueryPerformanceFrequency(&freq);
	return (double)(t.QuadPart) / (double)freq.QuadPart;
}

void KTimer::Start()
{
	mStartTime = GetSystemElapsedTime();
}

double KTimer::Stop()
{
	double current = GetSystemElapsedTime();
	double res = current - mStartTime;
	mStartTime = current;
	return res;
}